Skip to content

feat: markets resource#13

Merged
MarketDataDev03 merged 3 commits into
mainfrom
13_market_resource
Jun 18, 2026
Merged

feat: markets resource#13
MarketDataDev03 merged 3 commits into
mainfrom
13_market_resource

Conversation

@MarketDataDev03

Copy link
Copy Markdown
Collaborator

feat: markets resource (client.markets())

Branch 13_market_resource11_stocks_resource · 1 commit · 20 files

Adds the markets resource on the resource-architecture the options and stocks PRs established, closing out the per-resource series for v1. Markets expose a single endpointGET /v1/markets/status/, the exchange open/closed calendar — and no shared layer changed at all (transport, retry, rate-limit parsing, ParallelArrays, JsonResponseParser, MarketDataDates, RequestConfig are reused untouched). ADR-007 used MarketsResource as its canonical façade example; this PR makes that example real.

Reviewer entry point: docs/MARKETS_REVIEW_GUIDE.md (~10 minutes, organized by flow). If you reviewed the stocks PR, the only genuinely new content is the markets-specific semantics below and the all-optional parameter surface.

What's included

  • Resource façade (MarketsResource, reached via client.markets()): status / statusAsync (ADR-006 sync+async parity), universal-param setters (dateFormat/mode/limit/offset/columns) returning configured copies, asCsv() facet carrying the config, package-private asHtml() (built, hidden until the backend serves HTML). Package-private constructor (ADR-007).
  • Request types (com.marketdata.sdk.markets, @NullMarked): Builder-based MarketStatusRequest where every parameter is optional — the only request in the SDK with a no-args of() (today's status, US calendar). Window is date XOR from/to (inclusive) XOR to+countback (positive, pairs with to), plus country (two-digit ISO 3166, pass-through).
  • Response model: MarketStatusResponse (thin AbstractMarketDataResponse<List<MarketStatus>>); MarketStatus(date, status) row record with derived isOpen()/isClosed() predicates over the verbatim wire value; wire columns date,status both required under the Option A contract; "s":"no_data" (how the backend answers non-US countries, as 404) → empty values(); per-response rateLimit() (§8.2) for free from the base.
  • Wire decoding: per-resource SimpleModule (marketdata-markets) registered programmatically; date decodes through the tolerant parseDateOrTimestampField (unix seconds default; date-only strings under dateformat=timestamp lift to America/New_York midnight).

Tests & demos

  • Unit: MarketsResourceTest — 21 tests (749 total on the branch, all green): endpoint routing (bare request → no query params), every param translated, open/closed decoding with market-zone dates, null-cell tolerance, date-only date strings, no_data/error envelopes, columns projection + both Option A failure modes, strict-by-default missing column, CSV/HTML facets, per-response rate-limit snapshot, and window validation.
  • Integration: MarketsIntegrationTest (one-week window asserting both statuses appear — any 8-day span contains a weekend; to+countback window), gated by MARKETDATA_RUN_INTEGRATION_TESTS=true.
  • Demo: MarketsApp (make demo-markets / ./gradlew runMarkets) scripts the mock server through every scenario, including the null-cell case — run green end-to-end. QuickstartApp gains its markets section.

Docs

  • docs/MARKETS_REVIEW_GUIDE.md — the review walkthrough.
  • CHANGELOG.md — markets entry under Unreleased/Added.
  • CLAUDE.md — markets moved from "deliberately deferred" to wired; funds lands on its parallel branch (12_funds_resource).

@MarketDataDev03 MarketDataDev03 self-assigned this Jun 11, 2026
@MarketDataDev03 MarketDataDev03 marked this pull request as ready for review June 11, 2026 12:00
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

The author of this PR, MarketDataDev03, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at support@codecov.io with any questions.

Comment thread docs/MARKETS_REVIEW_GUIDE.md
Comment thread src/test/java/com/marketdata/sdk/MarketsResourceTest.java Outdated
# Conflicts:
#	CHANGELOG.md
#	CLAUDE.md
#	Makefile
#	examples/consumer-test/build.gradle.kts
#	examples/consumer-test/src/main/java/com/marketdata/consumer/QuickstartApp.java
#	src/main/java/com/marketdata/sdk/MarketDataClient.java
@MarketDataDev03 MarketDataDev03 merged commit e927b95 into main Jun 18, 2026
3 checks passed
@MarketDataDev03 MarketDataDev03 deleted the 13_market_resource branch June 18, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants